<template>
	<el-dialog
		:title="
			!!row.userType
				? $t('common.agent_profit_rate_expired_log')
				: $t('common.member_profit_rate_expired_log')
		"
		center
		@close="handleClose"
		:visible.sync="visible"
		width="1200px"
		class="audit-confirm"
	>
		<Table :columns="columns" :data="data" />
		<el-pagination
			:current-page="pageNum"
			:page-size="pageSize"
			:page-sizes="pageSizes"
			:total="total || 0"
			:pager-count="9"
			layout="total, sizes,prev, pager, next, jumper"
			@current-change="handleCurrentChange"
			@size-change="handleSizeChange"
		></el-pagination>
	</el-dialog>
</template>
<script>
import Table from '@/components/Table'
import { columns as oriColumns } from '../columns'
import list from '@/mixins/list'
export default {
	name: 'ExpiredLogs',
	components: {
		Table
	},
	mixins: [list],
	props: {
		visible: {
			type: Boolean,
			default: false
		},
		row: {
			type: Object,
			default: () => {}
		}
	},
	data() {
		return {
			loading: false,
			modal: true,
			columns: [],
			data: []
		}
	},
	methods: {
		handleClose() {
			this.$emit('update:visible', false)
		},
		currentParams() {
			return {
				userName: this.row.userName,
				userType: this.row.userType,
				status: 2,
				...this.pageParams
			}
		},
		loadData() {
			const api = !this.row.userType
				? this.$api.memberRebateRatelistApi(this.currentParams())
				: this.$api.rebateRateListApi(this.currentParams())
			this.columns = oriColumns(this.row.userType === 0, true)
			api.then((res) => {
				if (res.code !== 200) return
				this.data = res.data.record
				this.pageNum = res.data.pageNum
				this.pageSize = res.data.pageSize
				this.total = res.data.totalRecord
				this.loading = false
			}).catch(() => {
				this.loading = false
			})
		}
	}
}
</script>

<style scoped>
::v-deep .commissionsDialog .rebateAllotMode {
	display: none;
}
/* ::v-deep .commissionsDialog .pointTable {
        display: none;
    } */
</style>
